]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
hdpi: Revert hacks
authorAdel Gadllah <adel.gadllah@gmail.com>
Tue, 18 Feb 2014 22:25:10 +0000 (23:25 +0100)
committerAdel Gadllah <adel.gadllah@gmail.com>
Tue, 18 Feb 2014 22:40:34 +0000 (23:40 +0100)
Revert the hacks that where added in response to a bug caused by
commit ba459f4d202

https://bugzilla.gnome.org/show_bug.cgi?id=705410

js/ui/layout.js
src/shell-global.c

index 4111c00937d1b9055953f2040e973722676b23be..82d848a5a236a8e1494c5bc365a14cfb37e81981 100644 (file)
@@ -31,9 +31,6 @@ const MESSAGE_TRAY_PRESSURE_TIMEOUT = 1000; // ms
 const HOT_CORNER_PRESSURE_THRESHOLD = 100; // pixels
 const HOT_CORNER_PRESSURE_TIMEOUT = 1000; // ms
 
-// We scale up when the dpi is higher then this (same value used by gsd)
-const HIGH_DPI_LIMIT = 192;
-
 function isPopupMetaWindow(actor) {
     switch(actor.meta_window.get_window_type()) {
     case Meta.WindowType.DROPDOWN_MENU:
@@ -489,25 +486,8 @@ const LayoutManager = new Lang.Class({
         return false;
     },
 
-    _updateScaling: function() {
-        let primary = this.monitors[this.primaryIndex];
-        let width_mm = global.gdk_screen.get_monitor_width_mm(this.primaryIndex);
-        let height_mm = global.gdk_screen.get_monitor_height_mm(this.primaryIndex);
-        if (width_mm == 0 || height_mm == 0) {
-            St.ThemeContext.get_for_stage(global.stage).scale_factor = 1;
-            return;
-        }
-        let dpi_x = primary.width / (width_mm / 25.4);
-        let dpi_y = primary.height / (height_mm / 25.4);
-        if (dpi_x > HIGH_DPI_LIMIT && dpi_y > HIGH_DPI_LIMIT)
-            St.ThemeContext.get_for_stage(global.stage).scale_factor = 2;
-        else
-            St.ThemeContext.get_for_stage(global.stage).scale_factor = 1;
-    },
-
     _monitorsChanged: function() {
         this._updateMonitors();
-        this._updateScaling();
         this._updateBoxes();
         this._updateTrayBarrier();
         this._updateHotCorners();
index cc82566f913c91ea99fcb610e700d0bad036acca..b2b6e527fafb07e052012c3338ef499c88ef4d60 100644 (file)
@@ -746,6 +746,20 @@ global_stage_after_paint (gpointer data)
   return TRUE;
 }
 
+
+static void
+update_scale_factor (gpointer data)
+{
+  ShellGlobal *global = SHELL_GLOBAL (data);
+  ClutterStage *stage = CLUTTER_STAGE (global->stage);
+  StThemeContext *context = st_theme_context_get_for_stage (stage);
+  GValue value = G_VALUE_INIT;
+
+  g_value_init (&value, G_TYPE_INT);
+  gdk_screen_get_setting (global->gdk_screen, "gdk-window-scaling-factor", &value);
+  g_object_set (context, "scale-factor", g_value_get_int (&value), NULL);
+}
+
 /* This is an IBus workaround. The flow of events with IBus is that every time
  * it gets gets a key event, it:
  *
@@ -924,9 +938,19 @@ _shell_global_set_plugin (ShellGlobal *global,
   g_signal_connect (global->meta_display, "notify::focus-window",
                     G_CALLBACK (focus_window_changed), global);
 
+  /*
+   * We connect to GdkScreen's monitors-changed here to avoid
+   * a race condition. GdkScreen's monitors-changed signal is
+   * emitted *after* the xsetting has been updated.
+   */
+  g_signal_connect (global->gdk_screen, "monitors-changed",
+                    G_CALLBACK (update_scale_factor), global);
+
   gdk_event_handler_set (gnome_shell_gdk_event_handler, global, NULL);
 
   global->focus_manager = st_focus_manager_get_for_stage (global->stage);
+
+  update_scale_factor (global);
 }
 
 GjsContext *